home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.event.ActionEvent;
- import javax.swing.AbstractAction;
- import javax.swing.tree.TreePath;
-
- public class BasicTreeUI$TreeTraverseAction extends AbstractAction {
- // $FF: synthetic field
- private final BasicTreeUI this$0;
- protected int direction;
- private boolean changeSelection;
-
- public BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3) {
- this(var1, var2, var3, true);
- }
-
- private BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, int var2, String var3, boolean var4) {
- this.this$0 = var1;
- this.direction = var2;
- this.changeSelection = var4;
- }
-
- // $FF: synthetic method
- BasicTreeUI$TreeTraverseAction(BasicTreeUI var1, BasicTreeUI.1 var2, int var3, String var4, boolean var5) {
- this(var1, var3, var4, var5);
- }
-
- public void actionPerformed(ActionEvent var1) {
- int var2;
- if (this.this$0.tree != null && (var2 = this.this$0.getRowCount(this.this$0.tree)) > 0) {
- int var3 = BasicTreeUI.access$5(this.this$0);
- int var4;
- if (var3 == -1) {
- var4 = 0;
- } else if (this.direction == 1) {
- if (!this.this$0.isLeaf(var3) && !this.this$0.tree.isExpanded(var3)) {
- this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
- var4 = -1;
- } else {
- var4 = Math.min(var3 + 1, var2 - 1);
- }
- } else if (!this.this$0.isLeaf(var3) && this.this$0.tree.isExpanded(var3)) {
- this.this$0.toggleExpandState(this.this$0.getPathForRow(this.this$0.tree, var3));
- var4 = -1;
- } else {
- TreePath var5 = this.this$0.getPathForRow(this.this$0.tree, var3);
- if (var5 != null && var5.getPathCount() > 1) {
- var4 = this.this$0.getRowForPath(this.this$0.tree, var5.getParentPath());
- } else {
- var4 = -1;
- }
- }
-
- if (var4 != -1) {
- if (this.changeSelection) {
- this.this$0.tree.setSelectionInterval(var4, var4);
- } else {
- BasicTreeUI.access$6(this.this$0, this.this$0.getPathForRow(this.this$0.tree, var4), true);
- }
-
- this.this$0.ensureRowsAreVisible(var4, var4);
- }
- }
-
- }
-
- public boolean isEnabled() {
- return this.this$0.tree != null && this.this$0.tree.isEnabled();
- }
- }
-